/*
 * Copyright 2025 Nimtable
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


// This file is auto-generated by @hey-api/openapi-ts

export type LoginRequest = {
    username: string;
    password: string;
};

export type LoginResponse = {
    success: boolean;
    /**
     * JWT token for authentication
     */
    token: string;
};

export type LogoutResponse = {
    success: boolean;
};

export type PasswordResetRequest = {
    /**
     * Current password for verification
     */
    currentPassword: string;
    /**
     * New password to set
     */
    newPassword: string;
};

export type PasswordResetResponse = {
    /**
     * Success message
     */
    message: string;
};

export type _Error = {
    code: string;
    message: string;
    details?: string;
};

export type User = {
    id: number;
    username: string;
    /**
     * User's role name
     */
    role: 'admin' | 'editor' | 'viewer' | 'superadmin';
    profile?: {
        firstName?: string;
        lastName?: string;
        email?: string;
    } | null;
    createdAt: string;
    updatedAt: string;
};

export type UserCreate = {
    username: string;
    password: string;
    /**
     * Role ID (1: admin, 2: editor, 3: viewer, 4: superadmin)
     */
    roleId: number;
    profile?: {
        firstName?: string;
        lastName?: string;
        email?: string;
    };
};

/**
 * Only role modification is allowed. Requires admin or superadmin permissions.
 */
export type UserUpdate = {
    /**
     * Role ID (1: admin, 2: editor, 3: viewer, 4: superadmin)
     */
    roleId: number;
};

/**
 * Update current user's profile information
 */
export type UserProfileUpdate = {
    username?: string;
    password?: string;
    firstName?: string;
    lastName?: string;
    email?: string;
};

export type LoginData = {
    body: LoginRequest;
    path?: never;
    query?: never;
    url: '/acc-api/auth/login';
};

export type LoginErrors = {
    /**
     * Invalid request parameters
     */
    400: _Error;
    /**
     * Invalid credentials
     */
    403: _Error;
};

export type LoginError = LoginErrors[keyof LoginErrors];

export type LoginResponses = {
    /**
     * Login successful
     */
    200: LoginResponse;
};

export type LoginResponse2 = LoginResponses[keyof LoginResponses];

export type LogoutData = {
    body?: never;
    path?: never;
    query?: never;
    url: '/acc-api/auth/logout';
};

export type LogoutErrors = {
    /**
     * Unauthorized
     */
    401: _Error;
};

export type LogoutError = LogoutErrors[keyof LogoutErrors];

export type LogoutResponses = {
    /**
     * Logout successful
     */
    200: LogoutResponse;
};

export type LogoutResponse2 = LogoutResponses[keyof LogoutResponses];

export type ResetPasswordData = {
    body: PasswordResetRequest;
    path?: never;
    query?: never;
    url: '/acc-api/auth/reset-password';
};

export type ResetPasswordErrors = {
    /**
     * Invalid request parameters
     */
    400: _Error;
    /**
     * Unauthorized or invalid current password
     */
    401: _Error;
    /**
     * User not found
     */
    404: _Error;
    /**
     * Internal server error
     */
    500: _Error;
};

export type ResetPasswordError = ResetPasswordErrors[keyof ResetPasswordErrors];

export type ResetPasswordResponses = {
    /**
     * Password updated successfully
     */
    200: PasswordResetResponse;
};

export type ResetPasswordResponse = ResetPasswordResponses[keyof ResetPasswordResponses];

export type GetCurrentUserProfileData = {
    body?: never;
    path?: never;
    query?: never;
    url: '/acc-api/user-info';
};

export type GetCurrentUserProfileErrors = {
    /**
     * Unauthorized - Invalid or missing token
     */
    401: _Error;
    /**
     * User not found
     */
    404: _Error;
};

export type GetCurrentUserProfileError = GetCurrentUserProfileErrors[keyof GetCurrentUserProfileErrors];

export type GetCurrentUserProfileResponses = {
    /**
     * Successfully retrieved user profile
     */
    200: User;
};

export type GetCurrentUserProfileResponse = GetCurrentUserProfileResponses[keyof GetCurrentUserProfileResponses];

export type UpdateCurrentUserProfileData = {
    body: UserProfileUpdate;
    path?: never;
    query?: never;
    url: '/acc-api/user-info';
};

export type UpdateCurrentUserProfileErrors = {
    /**
     * Invalid request parameters
     */
    400: _Error;
    /**
     * Unauthorized
     */
    401: _Error;
    /**
     * Username already exists
     */
    409: _Error;
    /**
     * Internal server error
     */
    500: _Error;
};

export type UpdateCurrentUserProfileError = UpdateCurrentUserProfileErrors[keyof UpdateCurrentUserProfileErrors];

export type UpdateCurrentUserProfileResponses = {
    /**
     * User profile updated successfully
     */
    200: User;
};

export type UpdateCurrentUserProfileResponse = UpdateCurrentUserProfileResponses[keyof UpdateCurrentUserProfileResponses];

export type GetUsersData = {
    body?: never;
    path?: never;
    query?: never;
    url: '/acc-api/users';
};

export type GetUsersErrors = {
    /**
     * Unauthorized
     */
    401: _Error;
};

export type GetUsersError = GetUsersErrors[keyof GetUsersErrors];

export type GetUsersResponses = {
    /**
     * Successfully retrieved user list
     */
    200: Array<User>;
};

export type GetUsersResponse = GetUsersResponses[keyof GetUsersResponses];

export type CreateUserData = {
    body: UserCreate;
    path?: never;
    query?: never;
    url: '/acc-api/users';
};

export type CreateUserErrors = {
    /**
     * Invalid request parameters
     */
    400: _Error;
    /**
     * Username already exists
     */
    409: _Error;
    /**
     * Internal server error
     */
    500: _Error;
};

export type CreateUserError = CreateUserErrors[keyof CreateUserErrors];

export type CreateUserResponses = {
    /**
     * User created successfully
     */
    201: User;
};

export type CreateUserResponse = CreateUserResponses[keyof CreateUserResponses];

export type DeleteUserData = {
    body?: never;
    path: {
        userId: number;
    };
    query?: never;
    url: '/acc-api/users/{userId}';
};

export type DeleteUserErrors = {
    /**
     * Unauthorized
     */
    401: _Error;
    /**
     * User not found
     */
    404: _Error;
    /**
     * Internal server error
     */
    500: _Error;
};

export type DeleteUserError = DeleteUserErrors[keyof DeleteUserErrors];

export type DeleteUserResponses = {
    /**
     * User deleted successfully
     */
    204: void;
};

export type DeleteUserResponse = DeleteUserResponses[keyof DeleteUserResponses];

export type GetUserByIdData = {
    body?: never;
    path: {
        userId: number;
    };
    query?: never;
    url: '/acc-api/users/{userId}';
};

export type GetUserByIdErrors = {
    /**
     * Unauthorized
     */
    401: _Error;
    /**
     * User not found
     */
    404: _Error;
};

export type GetUserByIdError = GetUserByIdErrors[keyof GetUserByIdErrors];

export type GetUserByIdResponses = {
    /**
     * Successfully retrieved user
     */
    200: User;
};

export type GetUserByIdResponse = GetUserByIdResponses[keyof GetUserByIdResponses];

export type UpdateUserData = {
    body: UserUpdate;
    path: {
        userId: number;
    };
    query?: never;
    url: '/acc-api/users/{userId}';
};

export type UpdateUserErrors = {
    /**
     * Invalid request parameters or only role modification allowed
     */
    400: _Error;
    /**
     * Unauthorized
     */
    401: _Error;
    /**
     * Insufficient permissions or cannot modify own role
     */
    403: _Error;
    /**
     * User not found
     */
    404: _Error;
    /**
     * Internal server error
     */
    500: _Error;
};

export type UpdateUserError = UpdateUserErrors[keyof UpdateUserErrors];

export type UpdateUserResponses = {
    /**
     * User role updated successfully
     */
    200: User;
};

export type UpdateUserResponse = UpdateUserResponses[keyof UpdateUserResponses];

export type ClientOptions = {
    baseUrl: `${string}://src` | (string & {});
};